package Io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Copy_byte {
    public static void main(String[] args) {
        FileInputStream  fis=null;
        FileOutputStream fos=null;
        try {
            fis=new FileInputStream("D:\\.0学习\\Java\\QQ图片20210918131847.png");
            fos=new FileOutputStream("C:\\QQ图片20210918131847.png");
            byte[] bytes =new byte[1024*1024];
            int readcont=0;
            while((readcont=fis.read(bytes))!=-1){
                fos.write(bytes,0,readcont);
            }

            fos.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }
}
